﻿<UserControl x:Class="Qero.ChartPoint.SetLookup"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" 
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008" 
             mc:Ignorable="d" 
             d:DesignHeight="300" d:DesignWidth="600" Background="#FFE9E9E9" xmlns:my="clr-namespace:Qero.ChartPoint">
    <UserControl.Resources>
        <my:NodeCornersConverter x:Key="nodeCornersConverter" />
        <my:NodeMarginConverter x:Key="nodeMarginConverter" />
        <Style x:Key="ButtonFocusVisual">
            <Setter Property="Control.Template">
                <Setter.Value>
                    <ControlTemplate>
                        <Border>
                            <Rectangle SnapsToDevicePixels="true" Margin="4" Stroke="Black" StrokeDashArray="1 2" StrokeThickness="1"/>
                        </Border>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <Style x:Key="DownTwinButton" TargetType="{x:Type Button}">
            <Style.Triggers>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="True">
                    <Setter Property="Control.Visibility" Value="Visible" />
                </DataTrigger>
                <DataTrigger Binding="{Binding RelativeSource={RelativeSource Mode=FindAncestor, AncestorType={x:Type ListBoxItem}}, Path=IsSelected}" Value="False">
                    <Setter Property="Control.Visibility" Value="Collapsed" />
                </DataTrigger>
            </Style.Triggers>
            <Setter Property="FocusVisualStyle" Value="{StaticResource ButtonFocusVisual}"/>
            <Setter Property="Background" Value="{DynamicResource {x:Static SystemColors.ControlBrushKey}}"/>
            <Setter Property="Foreground" Value="{DynamicResource {x:Static SystemColors.ControlTextBrushKey}}"/>
            <Setter Property="HorizontalContentAlignment" Value="Center"/>
            <Setter Property="VerticalContentAlignment" Value="Center"/>
            <Setter Property="Template">
                <Setter.Value>
                    <ControlTemplate TargetType="{x:Type Button}">
                        <ControlTemplate.Resources>
                            <LinearGradientBrush x:Key="ButtonActBack" StartPoint="1,0" EndPoint="1,1">
                                <GradientStop Color="#FFDAF0FC" Offset=".2"/>
                                <GradientStop Color="#FFE7F5FD" Offset=".6"/>
                                <GradientStop Color="#FFBDE6FD" Offset=".6"/>
                                <GradientStop Color="#FFABDBF6" Offset=".9"/>
                            </LinearGradientBrush>
                            <LinearGradientBrush x:Key="ButtonStillBack" StartPoint="1,0" EndPoint="1,1">
                                <GradientStop Color="#FFE7E7E7" Offset=".9"/>
                                <GradientStop Color="Transparent" Offset=".2"/>
                            </LinearGradientBrush>
                            <Storyboard x:Key="ShowShine">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Shine" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.5000000" Value="1"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                            <Storyboard x:Key="HideShine">
                                <DoubleAnimationUsingKeyFrames BeginTime="00:00:00" Storyboard.TargetName="Shine" Storyboard.TargetProperty="(UIElement.Opacity)">
                                    <SplineDoubleKeyFrame KeyTime="00:00:00.3000000" Value="0"/>
                                </DoubleAnimationUsingKeyFrames>
                            </Storyboard>
                        </ControlTemplate.Resources>
                        <Border CornerRadius="1,1,6,6" BorderThickness="1" RenderTransformOrigin="0.5,0.5" x:Name="border" BorderBrush="#FF707070">
                            <Border.RenderTransform>
                                <TransformGroup>
                                    <ScaleTransform ScaleX="1" ScaleY="1"/>
                                </TransformGroup>
                            </Border.RenderTransform>
                            <Border Background="{TemplateBinding Background}" CornerRadius="0,1,5,5" x:Name="border1" BorderThickness="1" BorderBrush="{StaticResource ButtonStillBack}">
                                <Grid>
                                    <Grid.RowDefinitions>
                                        <RowDefinition Height="1*"/>
                                        <RowDefinition Height=".7*"/>
                                    </Grid.RowDefinitions>
                                    <Border CornerRadius="0,0,0,4" Background="{StaticResource ButtonStillBack}" />
                                    <Border Grid.RowSpan="2" Opacity="0" x:Name="Shine" CornerRadius="0,0,4,4" Background="{StaticResource ButtonActBack}"/>
                                    <ContentPresenter Grid.RowSpan="2" x:Name="contentPresenter"/>
                                </Grid>
                            </Border>
                        </Border>
                        <ControlTemplate.Triggers>
                            <Trigger Property="IsEnabled" Value="False">
                                <Setter Property="Opacity" TargetName="border" Value=".5"/>
                                <Setter Property="Opacity" TargetName="contentPresenter" Value=".7"/>
                            </Trigger>
                            <Trigger Property="IsPressed" Value="True">
                                <Setter Property="RenderTransform" TargetName="border">
                                    <Setter.Value>
                                        <TransformGroup>
                                            <ScaleTransform ScaleX="0.9" ScaleY="0.9"/>
                                        </TransformGroup>
                                    </Setter.Value>
                                </Setter>
                            </Trigger>
                            <Trigger Property="IsMouseOver" Value="True">
                                <Setter Property="BorderBrush" TargetName="border" Value="#FF3C7FB1" />
                                <Trigger.ExitActions>
                                    <BeginStoryboard Storyboard="{StaticResource HideShine}" x:Name="HideShine_BeginStoryboard"/>
                                </Trigger.ExitActions>
                                <Trigger.EnterActions>
                                    <BeginStoryboard x:Name="ShowShine_BeginStoryboard" Storyboard="{StaticResource ShowShine}"/>
                                </Trigger.EnterActions>
                            </Trigger>
                        </ControlTemplate.Triggers>
                    </ControlTemplate>
                </Setter.Value>
            </Setter>
        </Style>
        <DataTemplate x:Key="pointTemplate">
            <Border BorderBrush="#FF828790" BorderThickness="1" CornerRadius="{Binding Path=pointMake, Converter={StaticResource nodeCornersConverter}}" Padding="2,3,2,4" Margin="{Binding Path=pointMake, Converter={StaticResource nodeMarginConverter}}" Height="28" Width="{Binding Path=ActualWidth, ElementName=constHeader}">
                <Grid>
                    <Image Source="{Binding Path=icoPath}" Margin="6,1,0,1" HorizontalAlignment="Left"/>
                    <TextBlock Text="{Binding Path=pointHeader}" HorizontalAlignment="Left" Margin="48,0,4,0"/>
                </Grid>
            </Border>
        </DataTemplate>
    </UserControl.Resources>
    <Grid>
        <Grid.ColumnDefinitions>
            <ColumnDefinition/>
            <ColumnDefinition Width="6"/>
            <ColumnDefinition/>
        </Grid.ColumnDefinitions>
        <Rectangle Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Top" Height="4" Fill="#FFE9E9E9" />
        <Rectangle Grid.ColumnSpan="2" Panel.ZIndex="1" HorizontalAlignment="Stretch" Height="3" Fill="White" Margin="8,5,8,0" VerticalAlignment="Top" />
        <Rectangle Grid.ColumnSpan="2" Panel.ZIndex="1" HorizontalAlignment="Stretch" Height="3" Fill="White" Margin="8,0,8,5" VerticalAlignment="Bottom" />
        <Rectangle Grid.ColumnSpan="2" HorizontalAlignment="Stretch" VerticalAlignment="Bottom" Height="4" Fill="#FFE9E9E9" />
        <Button Grid.ColumnSpan="3" Style="{StaticResource DownTwinButton}" Height="18" Width="74" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="13,4,0,0" Panel.ZIndex="2" >
            <StackPanel Orientation="Horizontal">
                <Image Width="22" HorizontalAlignment="Left" Source="/Qero.ChartPoint;component/Pics/OkMark.png" />
                <TextBlock Margin="4,0,8,0" Text="OK" VerticalAlignment="Center"/>
            </StackPanel>
        </Button>
        <Button Grid.ColumnSpan="3" Style="{StaticResource DownTwinButton}" Height="18" Width="74" VerticalAlignment="Top" HorizontalAlignment="Left" Margin="91,4,0,0" Panel.ZIndex="2" >
            <StackPanel Orientation="Horizontal">
                <Image Width="22" HorizontalAlignment="Left" Source="/Qero.ChartPoint;component/Pics/CancelCr.png" />
                <TextBlock Margin="4,0,8,0" Text="Cancel" VerticalAlignment="Center"/>
            </StackPanel>
        </Button>
        <Border Name="mainBorder" Grid.ColumnSpan="3" Background="White" BorderThickness="1" CornerRadius="4" BorderBrush="#FF828790" Margin="4">
        </Border>
        <ListBox Name="srcListBox" Margin="8,54,4,8" ItemsSource="{Binding Path=PointSet}" ItemTemplate="{StaticResource pointTemplate}" ScrollViewer.VerticalScrollBarVisibility="Visible" BorderThickness="0"/>
        <Border Name="constHeader" BorderBrush="#FF828790" BorderThickness="1" CornerRadius="4,4,0,0" Margin="12,28,24,0" VerticalAlignment="Top" Height="28">
            <Image Width="24" Height="24" HorizontalAlignment="Left" Margin="6,1,0,1"/>
        </Border>
        <TextBlock Name="visionGrpName" Margin="48,34,30,0" VerticalAlignment="Top"/>
        <ListBox Name="dstListBox" Grid.Column="2" Margin="4,26,8,8" ScrollViewer.VerticalScrollBarVisibility="Visible" BorderThickness="0"/>
        <Image Grid.Column="1" Source="/Qero.ChartPoint;component/Pics/SplitterVert.png" />
        <GridSplitter Grid.Column="1" HorizontalAlignment="Stretch" VerticalAlignment="Stretch" Background="#02F0F0F0" />
    </Grid>
</UserControl>
